﻿<UserControl x:Class="VisualRibbonEditor.ConnectDialog"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	mc:Ignorable="d" 
	d:DesignHeight="305" d:DesignWidth="500" FontSize="12" KeyUp="ConnectDialog_KeyUp" FocusManager.IsFocusScope="True">

	<Border BorderThickness="2" BorderBrush="Black" >
		<Grid x:Name="LayoutRoot" Background="#fcfcfc">
			<Grid.RowDefinitions>
				<RowDefinition Height="*" />
				<RowDefinition Height="40" />
			</Grid.RowDefinitions>
			<StackPanel>
				<Border Background="#eeeeee" BorderThickness="0,0,0,1" BorderBrush="#aaaaaa">
					<TextBlock Text="Connect to CRM" FontSize="14" Margin="10" />
				</Border>

				<Grid Margin="15">
					<Grid.RowDefinitions>
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
					</Grid.RowDefinitions>
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="Auto" />
						<ColumnDefinition Width="Auto" />
					</Grid.ColumnDefinitions>

					<TextBlock Text="Connection: " Grid.Column="0" Grid.Row="0" VerticalAlignment="Center" />
					<StackPanel Grid.Column="1" Grid.Row="0" Orientation="Horizontal" Margin="0,-1,0,1" >
						<ComboBox Name="ConnectionProfiles" MinWidth="290" Margin="4" SelectionChanged="Connection_SelectionChanged" />
						<Button Name="DeleteConnection"  ToolTipService.ToolTip="Delete this connection" Click="DeleteConnection_Click" Margin="0 0 4 0" Height="22" IsEnabled="False">
							<StackPanel Orientation="Horizontal">
								<Image Source="/VisualRibbonEditor;component/Assets/delete.png" Name="DeleteConnectionImage" Height="16" Width="16" >
									<Image.OpacityMask>
										<SolidColorBrush Color="Gray" Opacity="0.5"/>
									</Image.OpacityMask>
								</Image>
							</StackPanel>
						</Button>
					</StackPanel>

					<TextBlock Text="CRM Server Url: " Grid.Column="0" Grid.Row="1" VerticalAlignment="Center" />
					<TextBox Name="ServerUrl" Text="http://server" Grid.Column="1" Grid.Row="1" MinWidth="200" Margin="4" LostFocus="ServerUrl_LostFocus" TextChanged="ServerUrl_TextChanged" />
					<TextBox Name="EntityName" Text="" Grid.Column="1" Grid.Row="1" MinWidth="0" Visibility="Collapsed" IsReadOnly="True" IsEnabled="False" />

					<TextBlock Text="CRM Organization Name: " Grid.Column="0" Grid.Row="2" VerticalAlignment="Center" />
					<TextBox Name="OrgName" Text="MyOrg" Grid.Column="1" Grid.Row="2" MinWidth="200" Margin="4" TextChanged="OrgName_TextChanged" ToolTip="Only required for On-Premise deployments" />

					<TextBlock Text="Login: " Grid.Column="0" Grid.Row="3" VerticalAlignment="Center" />
					<TextBox Name="Login" Text="domain\user" Grid.Column="1" Grid.Row="3" MinWidth="200" Margin="4" TextChanged="Login_TextChanged" />

					<TextBlock Text="Password: " Grid.Column="0" Grid.Row="4" VerticalAlignment="Center" />
					<PasswordBox Name="Password" Grid.Column="1" Grid.Row="4" MinWidth="200" Margin="4" />
					<CheckBox Grid.Row="5" Grid.Column="2" Name="ADFSMode" Margin="4" Content="ADFS / IFD Mode" />
					<CheckBox Grid.Row="6" Grid.Column="2" Name="SaveConnectionInfo" Margin="4" Content="Save Connection Info" Click="SaveConnectionInfo_Click" />
					<CheckBox Grid.Row="7" Grid.Column="2" Name="SavePassword" Margin="4" Content="Save Passwords (encrypted)" IsEnabled="False" />
				</Grid>


			</StackPanel>

			<!--<TextBlock Text="Loading entities, please wait..." Margin="209,67,47,74" Name="PleaseWait" FontStyle="Italic" />-->

			<Border Grid.Row="1"  BorderThickness="0,1,0,0" BorderBrush="#aaaaaa" >
				<StackPanel Orientation="Horizontal" HorizontalAlignment="Right"   >

					<TextBlock Text="Testing Connection..." Name="Testing" Visibility="Collapsed" FontSize="14" VerticalAlignment="Center" Margin="0,0,10,0"  />


					<Button Name="OKButton" Content="OK" Height="22" MinWidth="65" Margin="10,0,0,0" Click="OKButton_Click" />
					<Button Name="CancelButton" Content="Cancel" Height="22" MinWidth="65" Margin="10,0,10,0" Click="CancelButton_Click" />

				</StackPanel>
			</Border>

		</Grid>
	</Border>


</UserControl>
